#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int N = 0;
	int i = 0;
	int j = 0;
	int sum = 0;
	scanf("%d", &N);
	int* arr = (int*)malloc(sizeof(int) * N * N);
	for (i = 0; i < N; i++)
	{
		for (j = 0; j < N; j++)
		{
			scanf("%d", &arr[i * N + j]);
		}
	}
	for (i = 0; i < N; i++)
	{
		for (j = 0; j < N; j++)
		{
			if (i > j)
			{
				sum += arr[i * N + j];
			}
		}
	}
	if (sum == 0)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
		
}
